local zenhui = fk.CreateSkill {

  name = "joy__zenhui",

  tags = {  },

}



zenhui:addEffect(fk.TargetSpecifying, {
  name = "joy__zenhui",
  anim_type = "control",
  events = {fk.TargetSpecifying},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zenhui.name) and player.phase == Player.Play and 
      (data.card.trueName == "slash" or data.card:isCommonTrick()) and data.firstTarget and player:usedSkillTimes(zenhui.name, Player.HistoryPhase) == 0 and
      U.isOnlyTarget(player.room:getPlayerById(data.to), data, event)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    return room:askForSkillInvoke(player,zenhui.name,data,"#joy__zenhui-invoke::"..data.to)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(data.to)
      local cards = room:askForCard(to, 1, 1, true, zenhui.name, true, ".",
      "#joy__zenhui-give::"..player.id..":"..data.card:toLogString())
      if #cards > 0 then
        room:obtainCard(player, cards[1], false, fk.ReasonPrey)
      else 
        room:loseHp(to,1,zenhui.name)
      end
  end,
})

return zenhui